/*
 * crash_plot.h
 *
 *  Created on: 20.07.2013
 *      Author: SpirTanol
 */

#ifndef CRASH_PLOT_H_
#define CRASH_PLOT_H_

// QT
#include <QObject>

// Qwt
#include <qwt_plot.h>

class QwtPlotCurve;

class CrashOscillogramPacket;

class CrashPlot : public QwtPlot
{
	Q_OBJECT

	QVector<double> oTimes;
	struct CurveData
	{
		QwtPlotCurve *oCurve;
		QVector<double> oData;
	};
	CurveData oCurves[6];
	double oMinCurrent;

private slots:
	void showCurve(QwtPlotItem *, bool on);

public:
	enum Curve
	{
		C_CURRENT_A,
		C_CURRENT_B,
		C_CURRENT_C,

		C_VOLTAGE_A,
		C_VOLTAGE_B,
		C_VOLTAGE_C,
	};

	CrashPlot();
	CrashPlot(const CrashPlot *plot);
	~CrashPlot();

	void updateData(const CrashOscillogramPacket *data);

	inline void setMinCurrent(double min) { oMinCurrent = min; }

private:
	void init();

};

#endif /* CRASH_PLOT_H_ */
